<%@ page import="org.xilin.RoomSchedule" %>

<g:setProvider library="jquery"/>

<div class="bar">
  <span class="left">Class Room</span>
  <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
    <span class="btn right">
      <a class="create" href="javascript:void(0)" title="Add Room" rel="${request.contextPath}/roomSchedule/create">Add Room</a>
    </span>
  </g:if>
</div>

<x:pager/>
<table id="roomScheduleTable" class="tablesorter">
    <thead>
        <tr>
            <th/>
            <th>${message(code: 'roomSchedule.room.label', default: 'Room')}</th>
            <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
              <th class="delete">Del</th>
              <th class="edit">Edit</th>
            </g:if>

        </tr>
    </thead>
    <tbody>
    <g:each in="${roomScheduleInstanceList}" status="i" var="roomScheduleInstance">
        <tr>
            <td>${i+1}</td>
            <td>${fieldValue(bean: roomScheduleInstance, field: "room")}</td>
            <g:if test="${session.roles?.contains('ROLE_ADMIN')}">
              <td class="delete"><g:remoteLink action="delete" update="content" before="if(!confirm('Are you sure?')) return false;" id="${roomScheduleInstance.id}"><span class="ui-icon ui-icon-trash"/></g:remoteLink></td>
              <td class="edit"><a href="#" title="Edit Room" rel="${request.contextPath}/roomSchedule/edit/${roomScheduleInstance.id}"><span class="ui-icon ui-icon-pencil"/></a></td>
            </g:if>
        </tr>
    </g:each>
    </tbody>
</table>

<script type="text/javascript">
  $(function(){
      setupAdminList();
  });
</script>